Repository navigation
fix(s): answers and documents are read by shape, never cast - #1598
Open
rudolphpienaar wants to merge 5 commits into
Open
rudolphpienaar wants to merge 5 commits into
rudolphpienaar wants to merge 5 commits into
Conversation
A listing, a feed's access and tags, a run scheduled, a plugin instance row and a game's end each get a schema naming only the fields a surface reads. elements_read and fsListings_read keep the elements that read and name the ones left out, so one malformed block or entry no longer empties an answer.
Eleven sites took an envelope's model.data as whatever they expected. Each now reads it through menu's schemas: a malformed row is left out, a model of the wrong shape reads as no answer and never throws.
Plans, keeps, verify records, manifests, ChRIS secrets, kept state and REST/remote answers are read through zod schemas in the module that owns each type. A document that does not read is refused naming the document and the field, never quoting it; lists are read row by row; the nulls Red Hat answers today read as absent.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage S, item S5: answers and documents are read by their shape, never cast.
What
fs.listing,fs.acl,fs.xattr,run.scheduled, plugin instance rows, games trek/chime/show), pluselements_readandfsListings_read: a list is read element by element, so a malformed block, entry or row is left out and named while the rest are kept.model.datacasts (access, cycler, dashboard tiles, tags, answerModel listings, feedRows tags, trek end, and the surface host/session sites split out of main.ts) read through those schemas. A model of the wrong shape reads as no answer and never throws.state.json, Red Hat assisted-installer and GoDaddy answers, kube/remote output, harbor-oci checkout. A document that does not read is refused naming the document and the field, never quoting its content (ReadRefusal); lists are read row by row; the nulls Red Hat answers for a new cluster read as absent (SA5).Why
A cast lets a malformed document through and fails later as
undefined, far from its cause; a cast list drops every good row because of one bad one.Behaviour to note
state.jsonthat is no JSON object with anameis refused by its path.Tests
answers.test.ts: multi-path listing with surviving rows and partial diagnostics (an always-empty reader fails).typedAnswers.test.ts,dashboardTiles.test.ts: per-site wrong-shape and mixed answers; the cycler/dashboard/state cases fail on main's code.readers.test.ts: recorded plans/answers read, wrong-type fields refused by name, secrets never quoted, Red Hat's nulls accepted, kept state refused by its file.